--
-- PostgreSQL database dump
--

-- Dumped from database version 9.0.4
-- Dumped by pg_dump version 9.0.3
-- Started on 2011-09-13 11:02:33

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 332 (class 2612 OID 11574)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1524 (class 1259 OID 16594)
-- Dependencies: 1819 6
-- Name: canchas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE canchas (
    canchas_id integer NOT NULL,
    descripcion character varying(50),
    sucursales_id integer NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp without time zone DEFAULT now()
);


ALTER TABLE public.canchas OWNER TO postgres;

--
-- TOC entry 1525 (class 1259 OID 16598)
-- Dependencies: 6 1524
-- Name: canchas_canchas_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE canchas_canchas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.canchas_canchas_id_seq OWNER TO postgres;

--
-- TOC entry 1877 (class 0 OID 0)
-- Dependencies: 1525
-- Name: canchas_canchas_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE canchas_canchas_id_seq OWNED BY canchas.canchas_id;


--
-- TOC entry 1878 (class 0 OID 0)
-- Dependencies: 1525
-- Name: canchas_canchas_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('canchas_canchas_id_seq', 1, false);


--
-- TOC entry 1526 (class 1259 OID 16600)
-- Dependencies: 1821 6
-- Name: clientes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE clientes (
    clientes_id integer NOT NULL,
    apellido character varying(100) NOT NULL,
    nombre character varying(100) NOT NULL,
    dni character varying(8) NOT NULL,
    telefono character varying(30) NOT NULL,
    domicilio character varying(150),
    email character varying(30) NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp without time zone DEFAULT now()
);


ALTER TABLE public.clientes OWNER TO postgres;

--
-- TOC entry 1527 (class 1259 OID 16604)
-- Dependencies: 1526 6
-- Name: clientes_clientes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE clientes_clientes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.clientes_clientes_id_seq OWNER TO postgres;

--
-- TOC entry 1879 (class 0 OID 0)
-- Dependencies: 1527
-- Name: clientes_clientes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE clientes_clientes_id_seq OWNED BY clientes.clientes_id;


--
-- TOC entry 1880 (class 0 OID 0)
-- Dependencies: 1527
-- Name: clientes_clientes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('clientes_clientes_id_seq', 1, false);


--
-- TOC entry 1541 (class 1259 OID 16729)
-- Dependencies: 6
-- Name: conceptos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE conceptos (
    conceptos_id integer NOT NULL,
    descripcion character varying(100) NOT NULL
);


ALTER TABLE public.conceptos OWNER TO postgres;

--
-- TOC entry 1540 (class 1259 OID 16727)
-- Dependencies: 6 1541
-- Name: conceptos_conceptos_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE conceptos_conceptos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.conceptos_conceptos_id_seq OWNER TO postgres;

--
-- TOC entry 1881 (class 0 OID 0)
-- Dependencies: 1540
-- Name: conceptos_conceptos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE conceptos_conceptos_id_seq OWNED BY conceptos.conceptos_id;


--
-- TOC entry 1882 (class 0 OID 0)
-- Dependencies: 1540
-- Name: conceptos_conceptos_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('conceptos_conceptos_id_seq', 1, false);


--
-- TOC entry 1528 (class 1259 OID 16606)
-- Dependencies: 1824 6
-- Name: empleados; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE empleados (
    empleados_id integer NOT NULL,
    apellido character varying(100) NOT NULL,
    nombre character varying(100) NOT NULL,
    dni character varying(8) NOT NULL,
    telefono character varying(30) NOT NULL,
    domicilio character varying(150) NOT NULL,
    email character varying(30) NOT NULL,
    fecha_nacimiento date NOT NULL,
    sucursales_id integer NOT NULL,
    usuarios_id integer NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.empleados OWNER TO postgres;

--
-- TOC entry 1529 (class 1259 OID 16610)
-- Dependencies: 1528 6
-- Name: empleados_empleados_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE empleados_empleados_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.empleados_empleados_id_seq OWNER TO postgres;

--
-- TOC entry 1883 (class 0 OID 0)
-- Dependencies: 1529
-- Name: empleados_empleados_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE empleados_empleados_id_seq OWNED BY empleados.empleados_id;


--
-- TOC entry 1884 (class 0 OID 0)
-- Dependencies: 1529
-- Name: empleados_empleados_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('empleados_empleados_id_seq', 1, false);


--
-- TOC entry 1530 (class 1259 OID 16612)
-- Dependencies: 1825 6
-- Name: estados; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE estados (
    estados_id integer NOT NULL,
    descripcion character varying(50) NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp without time zone DEFAULT now()
);


ALTER TABLE public.estados OWNER TO postgres;

--
-- TOC entry 1531 (class 1259 OID 16616)
-- Dependencies: 1530 6
-- Name: estados_estados_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE estados_estados_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.estados_estados_id_seq OWNER TO postgres;

--
-- TOC entry 1885 (class 0 OID 0)
-- Dependencies: 1531
-- Name: estados_estados_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE estados_estados_id_seq OWNED BY estados.estados_id;


--
-- TOC entry 1886 (class 0 OID 0)
-- Dependencies: 1531
-- Name: estados_estados_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('estados_estados_id_seq', 1, false);


--
-- TOC entry 1539 (class 1259 OID 16710)
-- Dependencies: 1834 6
-- Name: perfiles; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE perfiles (
    perfiles_id integer NOT NULL,
    descripcion character varying(30) NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.perfiles OWNER TO postgres;

--
-- TOC entry 1538 (class 1259 OID 16708)
-- Dependencies: 1539 6
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE perfiles_perfiles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.perfiles_perfiles_id_seq OWNER TO postgres;

--
-- TOC entry 1887 (class 0 OID 0)
-- Dependencies: 1538
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE perfiles_perfiles_id_seq OWNED BY perfiles.perfiles_id;


--
-- TOC entry 1888 (class 0 OID 0)
-- Dependencies: 1538
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('perfiles_perfiles_id_seq', 1, false);


--
-- TOC entry 1532 (class 1259 OID 16618)
-- Dependencies: 1827 6
-- Name: sucursales; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE sucursales (
    sucursales_id integer NOT NULL,
    descripcion character varying(100) NOT NULL,
    domicilio character varying(150) NOT NULL,
    telefono character varying(30) NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp without time zone DEFAULT now()
);


ALTER TABLE public.sucursales OWNER TO postgres;

--
-- TOC entry 1533 (class 1259 OID 16622)
-- Dependencies: 6 1532
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE sucursales_sucursales_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.sucursales_sucursales_id_seq OWNER TO postgres;

--
-- TOC entry 1889 (class 0 OID 0)
-- Dependencies: 1533
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE sucursales_sucursales_id_seq OWNED BY sucursales.sucursales_id;


--
-- TOC entry 1890 (class 0 OID 0)
-- Dependencies: 1533
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('sucursales_sucursales_id_seq', 1, false);


--
-- TOC entry 1534 (class 1259 OID 16624)
-- Dependencies: 1830 6
-- Name: turnos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE turnos (
    turnos_id integer NOT NULL,
    fecha timestamp without time zone NOT NULL,
    hora_comienzo time without time zone NOT NULL,
    hora_fin time without time zone NOT NULL,
    estado integer NOT NULL,
    sucursales_id integer NOT NULL,
    clientes_id integer NOT NULL,
    canchas_id integer NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.turnos OWNER TO postgres;

--
-- TOC entry 1535 (class 1259 OID 16627)
-- Dependencies: 1534 6
-- Name: turnos_turnos_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE turnos_turnos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.turnos_turnos_id_seq OWNER TO postgres;

--
-- TOC entry 1891 (class 0 OID 0)
-- Dependencies: 1535
-- Name: turnos_turnos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE turnos_turnos_id_seq OWNED BY turnos.turnos_id;


--
-- TOC entry 1892 (class 0 OID 0)
-- Dependencies: 1535
-- Name: turnos_turnos_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('turnos_turnos_id_seq', 1, false);


--
-- TOC entry 1536 (class 1259 OID 16629)
-- Dependencies: 1832 6
-- Name: usuarios; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE usuarios (
    usuarios_id integer NOT NULL,
    username character varying(50) NOT NULL,
    password character varying(50) NOT NULL,
    perfiles_id integer NOT NULL,
    usuario character varying(50) NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.usuarios OWNER TO postgres;

--
-- TOC entry 1537 (class 1259 OID 16632)
-- Dependencies: 1536 6
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE usuarios_usuarios_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usuarios_usuarios_id_seq OWNER TO postgres;

--
-- TOC entry 1893 (class 0 OID 0)
-- Dependencies: 1537
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE usuarios_usuarios_id_seq OWNED BY usuarios.usuarios_id;


--
-- TOC entry 1894 (class 0 OID 0)
-- Dependencies: 1537
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('usuarios_usuarios_id_seq', 1, false);


--
-- TOC entry 1820 (class 2604 OID 16634)
-- Dependencies: 1525 1524
-- Name: canchas_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE canchas ALTER COLUMN canchas_id SET DEFAULT nextval('canchas_canchas_id_seq'::regclass);


--
-- TOC entry 1822 (class 2604 OID 16635)
-- Dependencies: 1527 1526
-- Name: clientes_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE clientes ALTER COLUMN clientes_id SET DEFAULT nextval('clientes_clientes_id_seq'::regclass);


--
-- TOC entry 1835 (class 2604 OID 16732)
-- Dependencies: 1541 1540 1541
-- Name: conceptos_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE conceptos ALTER COLUMN conceptos_id SET DEFAULT nextval('conceptos_conceptos_id_seq'::regclass);


--
-- TOC entry 1823 (class 2604 OID 16636)
-- Dependencies: 1529 1528
-- Name: empleados_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE empleados ALTER COLUMN empleados_id SET DEFAULT nextval('empleados_empleados_id_seq'::regclass);


--
-- TOC entry 1826 (class 2604 OID 16637)
-- Dependencies: 1531 1530
-- Name: estados_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE estados ALTER COLUMN estados_id SET DEFAULT nextval('estados_estados_id_seq'::regclass);


--
-- TOC entry 1833 (class 2604 OID 16713)
-- Dependencies: 1538 1539 1539
-- Name: perfiles_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE perfiles ALTER COLUMN perfiles_id SET DEFAULT nextval('perfiles_perfiles_id_seq'::regclass);


--
-- TOC entry 1828 (class 2604 OID 16638)
-- Dependencies: 1533 1532
-- Name: sucursales_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE sucursales ALTER COLUMN sucursales_id SET DEFAULT nextval('sucursales_sucursales_id_seq'::regclass);


--
-- TOC entry 1829 (class 2604 OID 16639)
-- Dependencies: 1535 1534
-- Name: turnos_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE turnos ALTER COLUMN turnos_id SET DEFAULT nextval('turnos_turnos_id_seq'::regclass);


--
-- TOC entry 1831 (class 2604 OID 16640)
-- Dependencies: 1537 1536
-- Name: usuarios_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE usuarios ALTER COLUMN usuarios_id SET DEFAULT nextval('usuarios_usuarios_id_seq'::regclass);


--
-- TOC entry 1863 (class 0 OID 16594)
-- Dependencies: 1524
-- Data for Name: canchas; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1864 (class 0 OID 16600)
-- Dependencies: 1526
-- Data for Name: clientes; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1871 (class 0 OID 16729)
-- Dependencies: 1541
-- Data for Name: conceptos; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1865 (class 0 OID 16606)
-- Dependencies: 1528
-- Data for Name: empleados; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1866 (class 0 OID 16612)
-- Dependencies: 1530
-- Data for Name: estados; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1870 (class 0 OID 16710)
-- Dependencies: 1539
-- Data for Name: perfiles; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1867 (class 0 OID 16618)
-- Dependencies: 1532
-- Data for Name: sucursales; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1868 (class 0 OID 16624)
-- Dependencies: 1534
-- Data for Name: turnos; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1869 (class 0 OID 16629)
-- Dependencies: 1536
-- Data for Name: usuarios; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1837 (class 2606 OID 16642)
-- Dependencies: 1524 1524
-- Name: canchas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY canchas
    ADD CONSTRAINT canchas_pkey PRIMARY KEY (canchas_id);


--
-- TOC entry 1839 (class 2606 OID 16644)
-- Dependencies: 1526 1526
-- Name: clientes_dni_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY clientes
    ADD CONSTRAINT clientes_dni_key UNIQUE (dni);


--
-- TOC entry 1841 (class 2606 OID 16646)
-- Dependencies: 1526 1526
-- Name: clientes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY clientes
    ADD CONSTRAINT clientes_pkey PRIMARY KEY (clientes_id);


--
-- TOC entry 1855 (class 2606 OID 16734)
-- Dependencies: 1541 1541
-- Name: conceptos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY conceptos
    ADD CONSTRAINT conceptos_pkey PRIMARY KEY (conceptos_id);


--
-- TOC entry 1843 (class 2606 OID 16648)
-- Dependencies: 1528 1528
-- Name: empleados_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT empleados_pkey PRIMARY KEY (empleados_id);


--
-- TOC entry 1845 (class 2606 OID 16650)
-- Dependencies: 1530 1530
-- Name: estados_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY estados
    ADD CONSTRAINT estados_pkey PRIMARY KEY (estados_id);


--
-- TOC entry 1853 (class 2606 OID 16716)
-- Dependencies: 1539 1539
-- Name: perfiles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY perfiles
    ADD CONSTRAINT perfiles_pkey PRIMARY KEY (perfiles_id);


--
-- TOC entry 1847 (class 2606 OID 16652)
-- Dependencies: 1532 1532
-- Name: sucursales_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY sucursales
    ADD CONSTRAINT sucursales_pkey PRIMARY KEY (sucursales_id);


--
-- TOC entry 1849 (class 2606 OID 16654)
-- Dependencies: 1534 1534
-- Name: turnos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY turnos
    ADD CONSTRAINT turnos_pkey PRIMARY KEY (turnos_id);


--
-- TOC entry 1851 (class 2606 OID 16656)
-- Dependencies: 1536 1536
-- Name: usuarios_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY usuarios
    ADD CONSTRAINT usuarios_pkey PRIMARY KEY (usuarios_id);


--
-- TOC entry 1859 (class 2606 OID 16657)
-- Dependencies: 1524 1534 1836
-- Name: canchas_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY turnos
    ADD CONSTRAINT canchas_id FOREIGN KEY (canchas_id) REFERENCES canchas(canchas_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1860 (class 2606 OID 16662)
-- Dependencies: 1526 1534 1840
-- Name: clientes_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY turnos
    ADD CONSTRAINT clientes_id FOREIGN KEY (clientes_id) REFERENCES clientes(clientes_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1862 (class 2606 OID 16722)
-- Dependencies: 1852 1539 1536
-- Name: perfiles_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY usuarios
    ADD CONSTRAINT perfiles_id FOREIGN KEY (perfiles_id) REFERENCES perfiles(perfiles_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1861 (class 2606 OID 16667)
-- Dependencies: 1846 1532 1534
-- Name: sucursales_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY turnos
    ADD CONSTRAINT sucursales_id FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1856 (class 2606 OID 16688)
-- Dependencies: 1532 1524 1846
-- Name: sucursales_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY canchas
    ADD CONSTRAINT sucursales_id FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1857 (class 2606 OID 16693)
-- Dependencies: 1528 1532 1846
-- Name: sucursales_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT sucursales_id FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1858 (class 2606 OID 16698)
-- Dependencies: 1850 1536 1528
-- Name: usuarios_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT usuarios_id FOREIGN KEY (usuarios_id) REFERENCES usuarios(usuarios_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1876 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-09-13 11:02:33

--
-- PostgreSQL database dump complete
--

